from rest_framework.permissions import DjangoModelPermissions, IsAdminUser
from rest_framework.viewsets import ModelViewSet
from apps.goods.models import SpecificationOption,SPUSpecification
from apps.wthg_admin.serializers.specs_options import SpecificationOptionModelSerializer,SPUSpecificationModelSerializer
from apps.wthg_admin.utils import UtilsPageNumberPagination
from rest_framework.generics import ListAPIView


class SpecificationOptionModelViewSet(ModelViewSet):
    """规格选项表管理视图"""

    queryset = SpecificationOption.objects.all()
    serializer_class = SpecificationOptionModelSerializer
    pagination_class = UtilsPageNumberPagination


class SPUSpecificationListAPIView(ListAPIView):
    """规格选项列表视图"""
    queryset = SPUSpecification.objects.all()
    serializer_class = SPUSpecificationModelSerializer



